#!/bin/sh

NEXTCLOUD_DIR='/usr/share/webapps/nextcloud'
: ${NEXTCLOUD_USER:="nextcloud"}

if [ "$(id -un)" != "$NEXTCLOUD_USER" ]; then
	exec su -s /bin/sh "$NEXTCLOUD_USER" -c '$0 "$@"' -- php82 $NEXTCLOUD_DIR/occ "$@"
else
	exec php82 $NEXTCLOUD_DIR/occ "$@"
fi
